#include<stdio.h>
#include<unistd.h>
#include<string.h>
#include<sys/types.h>
#include<sys/stat.h>
#include<fcntl.h>
int main()
{
  int fd=open("bite.txt",O_RDONLY);//只读
 //int fd=open("bite.txt",O_WRONLY|O_CREAT|O_TRUNC,0666);//文件权限为rw-rw-rw-
    // int fd=open("bite.txt",O_WRONLY|O_CREAT|O_APPEND,0666);
  if(fd<0)
  {
    perror("open");
    return 1;
  }
 printf("open success,fd:%d\n",fd);
//  const char*s="hello write\n";
//  const char*ss="hello append\n";
//  write(fd,s,strlen(s));
//  write(fd,ss,strlen(ss));
 char buff[128];
 memset(buff,'\0',sizeof(buff));
//while(read(fd,buff,sizeof(buff)))
//{
//  printf("%s",buff) ;     
//}
read(fd,buff,sizeof(buff));
printf("%s",buff);
  
 
 
  close(fd);
  return 0;
}
